/**
 * Created with Vim7.3 Mac
 * @fileOverview : 
 * @author : Lyle lylechen2014@gmail.com
 * @since : 2016-09-06 17:40:12
 * @filename : src/base/components/head.js
 * @version : 
 * @description : 
 */
define(function(require, exports, module) {

    var tpl = require('{base}/tpls/head.tpl');

    var head = {

    	template: _.template(tpl),

        render : function() {
            this.bindEvt();
            return this.template({
                menu : Config.NavigationMenu
            });
        }, 

        bindEvt: function(Dom) {
            var tthis = this;
            
            $("body").delegate(".menuName", "mouseover", function(){
                $(this).siblings().find('.menuList').hide();
                $(this).find('.menuList').show();
            });

            $("body").delegate(".menuName", "mouseleave", function(){
                $(this).find('.menuList').hide();
            });

            $("body").delegate(".menuListItem", "mouseover", function(){
                var twoMenu = $(this).find('dl');
                if(twoMenu.length > 0){
                    twoMenu.show()
                }
                
            });

            $("body").delegate(".menuName", "mouseleave", function(){
                var twoMenu = $(this).find('dl');
                if(twoMenu.length > 0){
                    twoMenu.hide()
                }
            });
        },
    }

    module.exports = head;
});


